int dirA = 12;
int dirB = 13;  // not used in this example
int speedA = 3;
int speedB = 11; // not used in this example

boolean elettroA = false;
boolean elettroB = true;

void setup()
{  
  pinMode (dirA, OUTPUT);
  pinMode (dirB, OUTPUT);
  pinMode (speedA, OUTPUT);
  pinMode (speedB, OUTPUT);

  noOutput();

}

void noOutput()
{
  digitalWrite(dirA, LOW);  
  digitalWrite(dirB, LOW);  
    
  digitalWrite(speedA, LOW);  
  digitalWrite(speedB, LOW);  
}

void loop()
{
 
  if(elettroA)
  {
    // open A
    digitalWrite (dirA, HIGH);
    digitalWrite (speedA, HIGH); 
    delay (50);
    digitalWrite (speedA, LOW); 
    
    delay (2000);

    // close A
    digitalWrite (dirA, LOW);
    digitalWrite (speedA, HIGH); 
    delay (50);
    digitalWrite (speedA, LOW); 
  }
  
  
  if(elettroB)
  {
    // open B
    digitalWrite (dirB, HIGH);
    digitalWrite (speedB, HIGH); 
    delay (50);
    digitalWrite (speedB, LOW); 
    
    delay (2000);

    // close B
    digitalWrite (dirB, LOW);
    digitalWrite (speedB, HIGH); 
    delay (50);
    digitalWrite (speedB, LOW); 
  }

  noOutput();
  delay(3000); 
}
